package cn.ncupyh.StudentUtil;


import java.util.ArrayList;

//工具类,用来实现:寻找集合中年龄最大的学生
public class StudentUtil {
public static Student findMaxAge(ArrayList<Student> students) {
    Student max = students.get(0);
    for (int i = 1; i < students.size(); i++) {
        Student su = students.get(i);
        if(max.getAge() < su.getAge()){
            max = su;
        }
    }
    return max;
}
}
